﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GA.Shared.Objects;
using GA.Shared.Interfaces;

namespace GA.Server.Api
{
    public interface IObjectServer
    {
        /// <summary>
        /// Creates an object of the specified type.
        /// </summary>
        /// <typeparam name="T">Type to search.</typeparam>
        /// <param name="authorizedUser">Authorized user to create the object.</param>
        /// <param name="newObject">Object to fix.</param>
        /// <returns>Object created.</returns>
        SerializableTransferObject CreateObject(SerializableTransferObject authorizedUser, SerializableTransferObject newObject);

        /// <summary>
        /// Edits an object of the specified type.
        /// </summary>
        /// <typeparam name="T">Type to search.</typeparam>
        /// <param name="authorizedUser">Authorized user to create the object.</param>
        /// <param name="editObject">Object to fix.</param>
        void EditObject(SerializableTransferObject authorizedUser, SerializableTransferObject editObject);

        /// <summary>
        /// Deletes an object of the specified type.
        /// </summary>
        /// <typeparam name="T">Type to search.</typeparam>
        /// <param name="authorizedUser">Authorized user to delete the object.</param>
        /// <param name="deleteObject">Object to fix.</param>
        void DeleteObject(SerializableTransferObject authorizedUser, SerializableTransferObject deleteObject);

        /// <summary>
        /// Gets a specific object using parameters.
        /// </summary>
        /// <typeparam name="T">Type to search.</typeparam>
        /// <param name="authorizedUser">Authorized user to find the object.</param>
        /// <param name="parameters">Parameters to search.</param>
        /// <returns>Object found; null if nothing was found.</returns>
        SerializableTransferObject GetObject(SerializableTransferObject authorizedUser, string type, Dictionary<string, object> parameters);

        /// <summary>
        /// Gets a list of objects using parameters.
        /// </summary>
        /// <typeparam name="T">Type to search.</typeparam>
        /// <param name="authorizedUser">Authorized user to find the object.</param>
        /// <param name="parameters">Parameters to search.</param>
        /// <returns>Objects found; empty collection if nothing is found; null if user didn't have permission.</returns>
        IEnumerable<SerializableTransferObject> GetObjects(SerializableTransferObject authorizedUser, string type, Dictionary<string, object> parameters);
    }
}
